package org.absolutezero.client.di;

import javax.inject.Singleton;

import org.absolutezero.client.Refrigerator;
import org.absolutezero.client.RefrigeratorApp;
import org.absolutezero.client.RefrigeratorController;
import org.absolutezero.client.presenter.NavigationMenuPresenter;
import org.absolutezero.client.presenter.PageContentPresenter;
import org.absolutezero.client.presenter.PageHeaderPresenter;
import org.absolutezero.client.presenter.RecipesPresenter;
import org.absolutezero.client.presenter.ShelvesPresenter;
import org.absolutezero.client.view.NavigationMenuView;
import org.absolutezero.client.view.PageContentView;
import org.absolutezero.client.view.PageView;
import org.absolutezero.client.view.RecipesView;
import org.absolutezero.client.view.ShelvesView;
import org.absolutezero.shared.RefrigeratorRequestFactory;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.inject.client.AbstractGinModule;

public class InjectorModule extends AbstractGinModule {

	@Override
	protected void configure() {
		/*
		 * Core
		 */
		bind(RefrigeratorApp.class).in(Singleton.class);
		bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
		bind(RefrigeratorController.class).in(Singleton.class);
		bind(EntryPoint.class).to(Refrigerator.class);
		
		/*
		 * Views
		 */
		bind(PageContentView.class).in(Singleton.class);
		bind(PageView.class).in(Singleton.class);
		bind(NavigationMenuView.class).in(Singleton.class);
		bind(ShelvesView.class).in(Singleton.class);
		bind(RecipesView.class).in(Singleton.class);
		
		/*
		 * Presenters
		 */
		bind(PageHeaderPresenter.class).in(Singleton.class);
		bind(PageContentPresenter.class).in(Singleton.class);
		bind(NavigationMenuPresenter.class).in(Singleton.class);
		bind(RecipesPresenter.class).in(Singleton.class);
		bind(ShelvesPresenter.class).in(Singleton.class);
		
		/*
		 * Request Factory
		 */
		bind(RefrigeratorRequestFactory.class).in(Singleton.class);
		
		requestStaticInjection(Refrigerator.class);
	}

}
